
*===============================================================================
* Replication Do-file
* Project: The Impact of the Tigray War on Child Education and Labor in Ethiopia
* Data Sources: Ethiopian Socioeconomic Survey (ESS) and ACLED Conflict Data
* Authors     : Dainn Wie, Demeke Yemareshet
* Affiliation : National Graduate Institute for Policy Studies, Tokyo, Japan
* Contact     : wie-dainn@grips.ac.jp, hailuyemar@gmail.com
* Description: Generate Table 1-Table 6 in the manuscript
*===============================================================================

*===============================================================================
* Programs to be installed
* ssc install geodist
* ssc install reghdfe
* ssc install ftools
*===============================================================================

*---------------------------
* Set-up Workig Directory
*---------------------------

*Please change the following line for replication.
cd "C:\Users\wie-dainn\Dropbox\Work\Yema\Analysis.CH2"   //Dainn
*cd "C:\Users\hailu\Dropbox\Yema\Writing.CH2\Replication Package" // Yema's path

*---------------------------
* Preamble
 *---------------------------

clear all
set more off

/*
******************************************************
* TABLE 1 - Impact of Conflict on School Attendance
******************************************************
use "Data\ESS_2018_2021_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Serious incident within 20km"
label var Exposure_20km_fatalities "Fatalities within 20km"
label var Exposure_20km_continuous "Incident count within 20km"
label var Exposure_20km_fatalitdummy "Any fatality within 20km"
label var Exposure_50km_dummy "Serious incident within 50km"
label var Exposure_50km_continuous "Incident count within 50km"


* (1) Conflict Exposure (20km Dummy)
reghdfe attending_school Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
sum attending_school if e(sample)==1
local mean=r(mean)
local sd=r(sd)

outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_20km_dummy) replace title("Table 1: The Impact of Conflict on Children's School Attendance") addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele) addnote(The sample includes children aged 7 to 16 in 2018/19 who are observed in both the ESS 2018/19 and 2021/22 waves. The dependent variable is a binary indicator for attending school. Conflict exposure is measured either by incidents or by fatalities and takes zero values for pre-conflict period. Serious incidents are defined as any conflict event with more than five fatalities. All specifications control the child, age, and year fixed effects. Standard errors are reported in parentheses and are clustered at the kebele level. The mean and standard deviation of the outcome variable are `mean' and `sd'. *** ** * denote significance at 1% 5% 10% respectively.)

* (2) Conflict Exposure (20km Fatalities - Dummy) 
reghdfe attending_school Exposure_20km_fatalitdummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_20km_fatalitdummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)


* (3) Conflict Exposure (20km Incidents Continuous)
reghdfe attending_school Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_20km_continuous) append  addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(4) Conflict Exposure (20km Fatalities - Continuous)
reghdfe attending_school Exposure_20km_fatalities i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_20km_fatalities) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)


*(5) Conflict Exposure (20km) Combined Exposure - Incidents & Fatalities (Continuous)
reghdfe attending_school Exposure_20km_continuous Exposure_20km_fatalities i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_20km_continuous Exposure_20km_fatalities) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)


*(6) Conflict Exposure (50km Dummy)
reghdfe attending_school Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_50km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)


*(7) Conflict Exposure (50km Incidents=Continuous)
reghdfe attending_school Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table1.doc, label dec(3) keep(Exposure_50km_continuous) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)




******************************************************
* TABLE 2 - Impact of Conflict on School Attendance
* Heterogeneous Effects by Child Sex (Male vs. Female)
******************************************************

use "Data\ESS_2018_2021_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Serious incident within 20km"
label var Exposure_20km_continuous "Incident count within 20km"
label var Exposure_50km_dummy "Serious incident within 50km"
label var Exposure_50km_continuous "Incident count within 50km"

*(1) Boys 20km Dummy
reghdfe attending_school Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
sum attending_school if e(sample)==1
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_20km_dummy) replace ctitle(Boys) title("Table 2: The Impact of Conflict on School Attendance by Gender") addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele) addnote(Note: See note under Table 1.)
*(2) Boys 50km Dummy
reghdfe attending_school Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle(Boys) addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(3) Boys 20km Incident counts
reghdfe attending_school Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle(Boys) addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(4) Boys 50km Incident counts
reghdfe attending_school Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle(Boys) addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(5) Girls 20km Dummy
reghdfe attending_school Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
sum attending_school if e(sample)==1
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_20km_dummy) append ctitle(Girls) addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(6) Girls 50km Dummy
reghdfe attending_school Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle(Girls) addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(7) Girls 20km Incident counts
reghdfe attending_school Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle(Girls)  addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(8) Girls 50km Incident counts
reghdfe attending_school Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table2.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle(Girls)  addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)


**********************************************************************
* Table 3: Effects of Conflict on Four Forms of Child Labor by Gender
**********************************************************************

use "Data\ESS_2018_2021_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Conflict (20km)"
label var Exposure_20km_continuous "#Incidents (20km)"
label var Exposure_50km_dummy "Conflict (50km)"
label var Exposure_50km_continuous "#Incidents (50km)"

* Table 3A: Employment for Cash/Food

*(1) Full sample-20KM
reghdfe employed_cash_food Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
sum employed_cash_food if e(sample)==1
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_20km_continuous) replace ctitle(All) title("Table 3: Effects of Conflict on Four Forms of Child Labor by Gender") 
*(2) Full sample-50km
reghdfe employed_cash_food Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle(All) 
*(3) Boys-20km
reghdfe employed_cash_food Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
sum employed_cash_food if e(sample)==1
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle(Boys) 
*(4) Boys-50km
reghdfe employed_cash_food Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle(Boys) 
*(5) Girls-20km
reghdfe employed_cash_food Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
sum employed_cash_food if e(sample)==1
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle(Girls) 
*(6) Girls-50km
reghdfe employed_cash_food Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3A.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle(Girls)  


* Table 3B: Casual Labor

*(7) Full sample-20km
reghdfe casual_labour_work Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
sum casual_labour_work if e(sample)==1
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_20km_continuous) replace ctitle((7))  
*(8) Full sample-50km
reghdfe casual_labour_work Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((8))  
sleep 100
*(9)  Boys-20km
reghdfe casual_labour_work Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
sum casual_labour_work if e(sample)==1
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((9))  
*(10) Boys-50km
reghdfe casual_labour_work Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((10))  

*(11) Girls-20km
reghdfe casual_labour_work Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
sum casual_labour_work if e(sample)==1
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((11))  
*(12) Girls-50km
reghdfe casual_labour_work Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3B.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((12))  

* Table 3C: Unpaid Labor for Others

*(13)Full sample-20km
reghdfe worked_free_others Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
sum worked_free_others if e(sample)==1
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_20km_continuous) replace ctitle((13)) 
*(14)Full sample-50km
reghdfe worked_free_others Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((14))  
*(15)Boys-20km
reghdfe worked_free_others Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
sum worked_free_others if e(sample)==1
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((15))  
*(16)Boys-50km
reghdfe worked_free_others Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((16))  
*(17)Girls-20km
reghdfe worked_free_others Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
sum worked_free_others if e(sample)==1
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((17))  
*(18)Girls-50km
reghdfe worked_free_others Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3C.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((18))  

* Table 3D: Free Public Work

*(19) Full sample-20km
reghdfe free_labor_public Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
sum free_labor_public if e(sample)==1
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_20km_continuous) replace ctitle((19))  
*(20) Full sample-50km
reghdfe free_labor_public Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((20))  
*(21) Boys-20km
reghdfe free_labor_public Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
sum free_labor_public if e(sample)==1
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((21))  
*(22) Boys-50km
reghdfe free_labor_public Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((22))  
*(23) Girls-20km
reghdfe free_labor_public Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
sum free_labor_public if e(sample)==1
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((23))  
*(24) Girls-50km
reghdfe free_labor_public Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 0, absorb(pid Year) vce(cluster kid)
outreg2 using Tables\table3D.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((24)) 



***********************************************************************************
* Table 4 Exploring Child Labor and School Attendance as a Joint Decision by Gender
***********************************************************************************

use "Data\ESS_2018_2021_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Conflict (20km)"
label var Exposure_50km_dummy "Conflict (50km)"

* Construct Variables
gen child_labour = .
replace child_labour = 1 if employed_cash_food == 1 | casual_labour_work == 1 | worked_free_others == 1 | free_labor_public == 1
replace child_labour = 0 if child_labour == . 

gen not_attending = .
replace not_attending = 1 if currently_attending_school == 2
replace not_attending = 0 if currently_attending_school == 1

gen child_notatt_labour = .
replace child_notatt_labour = 1 if child_labour == 1 & not_attending == 1
replace child_notatt_labour = 0 if child_notatt_labour == . 

gen child_notatt_unpaid = .
replace child_notatt_unpaid = 1 if worked_free_others == 1 & not_attending == 1
replace child_notatt_unpaid = 0 if child_notatt_unpaid == . 

gen child_notatt_free = .
replace child_notatt_free = 1 if free_labor_public == 1 & not_attending == 1
replace child_notatt_free = 0 if child_notatt_free == . 

drop if missing(attending_school) 


*(1)Boys Unpaid Household Labor-20km
reghdfe child_notatt_unpaid Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_20km_dummy) replace addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele) title("Table 4: Exploring Child Labor and School Attendance as a Joint Decision by Gender")

*(2)Boys Unpaid Household Labor-50km
reghdfe child_notatt_unpaid Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_50km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(3)Boys State-led Unpaid Labor-20km
reghdfe child_notatt_free Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_20km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(4)Boys State-led Unpaid Labor-50km
reghdfe child_notatt_free Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_50km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)


*(5)Girls Unpaid Household Labor-20km
reghdfe child_notatt_unpaid Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_20km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(6)Girls Unpaid Household Labor-50km
reghdfe child_notatt_unpaid Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_50km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(7)Girls State-led Unpaid Labor-20km
reghdfe child_notatt_free Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_20km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*(8)Girls State-led Unpaid Labor-50km
reghdfe child_notatt_free Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 0, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table4.doc, label dec(3) keep(Exposure_50km_dummy) append addtext(Child FE, Yes, Year FE, Yes, Cluster SE, Kebele)

*/

******************************************************************
* Table 5: The Impact of Conflict Exposure on Household-Level Shocks
******************************************************************

use "Data\ESS_2018_2021_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Conflict (20km)"
label var Exposure_20km_continuous "#Incidents (20km)"
label var Exposure_50km_dummy "Conflict (50km)"
label var Exposure_50km_continuous "#Incidents (50km)"

* Drop missing observations on school attendance
drop if missing(attending_school)

* Generate binary indicators for household-level shocks
gen death_hh_main = 1 if death_hh_member == 1
replace death_hh_main = 0 if death_hh_member == 2

gen drought_ = 1 if drought == 1
replace drought_ = 0 if drought == 2

gen other_crop_damage = 1 if crop_damage == 1
replace other_crop_damage = 0 if crop_damage == 2

gen death_of_livestock = 1 if death_livestock == 1
replace death_of_livestock = 0 if death_livestock == 2

gen theft_or_Robbery = 1 if theft == 1
replace theft_or_Robbery = 0 if theft == 2

gen death_any_member = 1 if death_member == 1
replace death_any_member = 0 if death_member == 2

* Table 5A: 
*Upper Panel: Theft/robbery

reghdfe theft_or_Robbery Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
sum theft_or_Robbery if e(sample)==1

outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_20km_dummy) replace ctitle((1)) title("Table 5: The Impact of Conflict Exposure on Household-Level Shocks")

reghdfe theft_or_Robbery Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle((2))  

reghdfe theft_or_Robbery Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((3))  

reghdfe theft_or_Robbery Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((4))  

* Upper Panel: Death of the main breadwinner

reghdfe death_hh_main Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
sum death_hh_main if e(sample)==1

outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_20km_dummy) append ctitle((5))  

reghdfe death_hh_main Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle((6))  

reghdfe death_hh_main Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((7))  

reghdfe death_hh_main Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5A.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((8))  

*Table 5B
*Lower Panel: Unusual price rise of food items
replace unusual_increpri_food=unusual_increpri_food-1
reghdfe unusual_increpri_food Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
sum unusual_increpri_food if e(sample)==1

outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_20km_dummy) append ctitle((9))  

reghdfe unusual_increpri_food Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle((10))  

reghdfe unusual_increpri_food Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((11)) 

reghdfe unusual_increpri_food Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((12))  


* Lower Panel: Unusual increase in price of inputs
replace unusual_increpri_inputs=unusual_increpri_inputs-1
reghdfe unusual_increpri_inputs Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
sum unusual_increpri_inputs if e(sample)==1

outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_20km_dummy) append ctitle((13))  

reghdfe unusual_increpri_inputs Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_50km_dummy) append ctitle((14))  

reghdfe unusual_increpri_inputs Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_20km_continuous) append ctitle((15))  

reghdfe unusual_increpri_inputs Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table5B.doc, label dec(3) keep(Exposure_50km_continuous) append ctitle((16))  

*/



******************************************************************
* Table 6: Placebo Test - The Impact of Conflict on Attending School
******************************************************************
use "Data\ESS_2013_2015_hh_acled_final.DTA", clear
egen kid=group(region zone district kebele)

label var Exposure_20km_dummy "Serious incident within 20km"
label var Exposure_20km_continuous "Incident count within 20km"
label var Exposure_50km_dummy "Serious incident within 50km"
label var Exposure_50km_continuous "Incident count within 50km"

drop if missing(attending_school) 

* Full Sample
*(1)
reghdfe attending_school Exposure_20km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_20km_dummy) replace  addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele) title("Table 6: Placebo Test: The Impact of Conflict on Attending School")
*(2)
reghdfe attending_school Exposure_50km_dummy i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_50km_dummy) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(3)
reghdfe attending_school Exposure_20km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_20km_continuous) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(4)
reghdfe attending_school Exposure_50km_continuous i.age_years [pweight = hh_weight], absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_50km_continuous) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)

* Boys Only
*(5)
reghdfe attending_school Exposure_20km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_20km_dummy) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(6)
reghdfe attending_school Exposure_50km_dummy i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_50km_dummy) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(7)
reghdfe attending_school Exposure_20km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_20km_continuous) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)
*(8)
reghdfe attending_school Exposure_50km_continuous i.age_years [pweight = hh_weight] if sex_new == 1, absorb (pid Year) vce (cluster kid)
outreg2 using Tables\table6.doc, label dec(3) keep(Exposure_50km_continuous) append   addtext(Child FE, Yes,  Year FE, Yes, Cluster SE, Kebele)

